<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/meta.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>灯灯网</title>
<script>
	function checkInput(){
		var name=document.getElementById("name");
		var pwd=document.getElementById("pwd");
		if(name.value==""){
			document.getElementById("name_msg").innerHTML="请输入您的用户名！";
			return;
			}else{
				document.getElementById("name_msg").innerHTML="";
				}
		if(isEmail(name.value)==false){
			document.getElementById("name_msg").innerHTML="您输入的用户名格式不正确！";
			return;
			}else{
				document.getElementById("name_msg").innerHTML="";
				}
		if(pwd.value==""){
			document.getElementById("pwd_msg").innerHTML="请输入您的密码！";
			return;
			}else{
				document.getElementById("pwd_msg").innerHTML="";
				}
		$.post("${ctx}/UserManager/user!isLogin.action",{"user.email":name.value,"user.password":pwd.value},islogin,"json");
		}

	function islogin(obj){
		var flag=obj.flag;
		if(flag==true){
			//跳转到加载自己的页面
			window.location="${ctx}/UserManager/user!userCenter.action";
			}else{
				document.getElementById("name_msg").innerHTML="您输入的用户名或密码有误！";
				}
		}
	
	function isEmail(str){

		var myReg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;

		if(myReg.test(str)) return true;

		return false;

		}
</script>
<link href="${ctx}/css/css.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div align="center" style="background:url(images/bg.jpg);">
  <div class="main_login" align="center">
    <div class="table_l">
  <table  border="0" cellspacing="8" cellpadding="0">
  <tr>
    <td rowspan="4" valign="top" style="color:#3686DF;"><img src="${ctx}/images/logo.png" width="200" height="109" /></td>
    <td>用户名：<input name="user"  class="input" id="name"/></td>
    <td><span id="name_msg"></span></td>
  </tr>
  <tr>
    <td>密&nbsp;&nbsp;&nbsp;码：<input name="password2" type="password" class="input" id="pwd"/></td>
    <td><span id="pwd_msg"></span></td>
  </tr>
  <tr>
    <td align="right"><a href="javascript:checkInput();"><img src="${ctx}/images/login.png"/></a></td>
    <td>&nbsp;</td>
  </tr>
  </table>
  </div>
    <div class="foot_l">灯灯网版权所有 京ICP备***号 关于灯灯 联系我们 招贤纳士 服务条款 隐私政策网</div>
  </div>
  
</div>
</body>
</html>

